package com.fencing_squad.homo.util;

import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import ohos.agp.components.Image;
import ohos.agp.components.element.Element;
import org.jetbrains.annotations.Nullable;

public class ImageLoader {
    public static RequestListener<Element> fail(Image image, int resId) {
        return new RequestListener<Element>() {
            @Override
            public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Element> target, boolean b) {
                image.setPixelMap(resId);
                return false;
            }

            @Override
            public boolean onResourceReady(Element element, Object o, Target<Element> target, DataSource dataSource, boolean b) {
                return false;
            }
        };
    }
}
